package com.jfinal.ext.sql;

import java.util.List;

import com.jfinal.plugin.activerecord.Db;

public abstract class SqlBuliderFactory extends Db {
	protected static final String EQUAL = " = ";
	protected static final String NO_EQUAL = " <> ";
	protected static final String LT = " < ";
	protected static final String LE = " <= ";
	protected static final String GE = " >= ";
	protected static final String GT = " > ";
	protected static final String BETWEEN = " between ";
	protected static final String NO_BETWEEN = " not between ";
	protected static final String IS_NULL = " is null";
	protected static final String NOT_NULL = " is not null";
	protected static StringBuffer sqlStr = null;
	protected static final String PLACEHOLDER = "?";
	protected static final String WHERE_STR = " where 1=1 ";
	protected static Criterion expression = null;
	protected static List<Object> values;// 值集合

	/**
	 * 检测sql语句
	 * 
	 * @return
	 */
	protected boolean sqlNotNull() {
		if (sqlStr != null) {
			return true;
		} else {
			throw new RuntimeException("解析SQL语句出错");
		}
	}

	/**
	 * List2Array
	 * 
	 * @param objList
	 * @return
	 */
	protected static Object[] list2Array(List<Object> objList) {
		if (objList != null) {
			return objList.toArray();
		} else {
			return null;
		}
	}

}
